<template>
  <div>
    <el-table
      v-loading="listLoading"
      :data="outinlist"
      :stripe="true"
      fit
      style="margin-top:10px"
      max-height="470px"
      height="470px"
      :header-cell-style="{background:'#eef1f6',color:'#606266'}"
    >
      <template slot="empty">
        <tableEmpty />
      </template>
      <el-table-column
        type="index"
        align="center"
        width="50px"
        label="序号"
      />
      <el-table-column
        label="姓名"
        prop="姓名"
        align="center"
      />
      <el-table-column
        label="身份证号码"
        prop="身份证号码"
        align="center"
      />
      <el-table-column
        label="调出"
        align="center"
      >
        <el-table-column
          label="代码"
          prop="调出单位编码"
          align="center"
        />
        <el-table-column
          label="单位"
          prop="调出单位"
          align="center"
        />
        <el-table-column
          label="归口"
          align="center"
        />
      </el-table-column>
      <el-table-column
        label="调入"
        align="center"
      >
        <el-table-column
          label="代码"
          prop="调入单位编码"
          align="center"
        />
        <el-table-column
          label="单位"
          prop="调入单位"
          align="center"
        />
        <el-table-column
          label="归口"
          align="center"
        />
      </el-table-column>

    </el-table>
    <pagination
      :total="total"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
      @pagination="getList"
    />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { getPersonChangeTurn } from '@/api/reportForm'
import tableEmpty from '@/components/table/empty'
export default {
  name: 'ComplexTable',
  components: {
    Pagination, tableEmpty
  },
  props: ['month'],
  data() {
    return {
      outinlist: [],
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 200,
        salaryMonth: ''
      }

    }
  },
  created() {
    this.listQuery.page = 1
    // this.getCurrenMonth()
    this.listQuery.salaryMonth = this.month
    this.getList()
  },
  methods: {
    // handleParQuery(month) {
    //   this.listQuery.page = 1
    //   this.listQuery.salaryMonth = this.month
    //   this.getList()
    // },
    getList() {
      this.listLoading = true
      getPersonChangeTurn(this.listQuery).then(response => {
        this.outinlist = response.data.rows
        this.total = response.data.total
        this.listLoading = false
      })
    },
    handleQuery() {
      this.listQuery.page = 1
      // this.listQuery.limit = 10
      this.getList()
    },
    getCurrenMonth() {
      const date = new Date()
      const month = (date.getMonth() + 1).toString().padStart(2, '0')
      const year = date.getFullYear()
      this.listQuery.salaryMonth = year + '-' + month
    }
  }
}
</script>
<style scoped>
</style>
